<?php
namespace SDXApi\Controller;
use Think\Controller;
class AdminController extends Controller {
	 public function setconfig(){
	 	$ROOT =  str_replace('\\','/',realpath(dirname(__FILE__).'/../../').'/');
	 	if(empty($path)){
	 		$path = $ROOT.'Common/Conf/';
	 	}else{
	 		$path = $ROOT.$path;
	 	}
	 	$filename = $path.'ectouch_system.php';
	 	//读取系统后台设置配置
	 	$config_list =D('ShopConfig')->get_config();
	 	$config_data = array();
	 	foreach ($config_list as $config){
	 		$config_data[$config['code']] = $config['value'];
	 	}
	 	//写入系统配置文件
	 	$strconfig = "<?php\r\nreturn ".var_export($config_data,true)."\r\n?>";
	 	if(!empty($config_data)){
	 		file_put_contents($filename, $strconfig);
	 	}

	 }
}